-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resampled wcs #449
Resampled wcs #449
Conversation
Hello @DanRyanIrish! Thanks for updating this PR.
Comment last updated at 2021-08-06 09:40:05 UTC |
@Cadair, here are my changes to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't sat down and worked through the maths of the translation (do you want me to?), but looks good otherwise.
Co-authored-by: Stuart Mumford <stuart@cadair.com>
Also reverted implementation of ResampledWCS.pixel_bounds.
A check on the maths would be welcome but not expected. |
In going through the tests, I've come across an important point regarding Consider a 1-D pixel grid that we upsample by a factor of 1/3, i.e. there are 3 new pixels for every old/underlying pixel. Say the pixel bounds were In the above example I chose numbers that worked out nicely in whole pixels. But this might not always be the case. We must therefore clarify what
|
According to @ayshih the answer to the above is option 3. |
22931f6
to
0b0230d
Compare
0b0230d
to
2cf0758
Compare
4154001
to
882d360
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, and I think I understand the new algorithm. I think this at least needs new tests for offset=
? also does it not need tests which demonstrate that the new algorithm is required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some mainly technical remarks; if my comments on the lengths of factor
and offset
are correct, those checks could perhaps use a test as well.
Co-authored-by: Derek Homeier <dhomeie@gwdg.de>
Hi @dhomeier. Thanks so much for your comments. I've taken them into account and will add an extra test as you suggest. |
return self._wcs.pixel_shape | ||
underlying_shape = np.asarray(self._wcs.pixel_shape) | ||
int_elements = np.isclose(np.mod(underlying_shape, self._factor), 0, | ||
atol=np.finfo(float).resolution) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually
int_elements = np.isclose(underlying_shape / self._factor, np.rint(underlying_shape / self._factor),
atol=np.finfo(float).resolution)
might be the most robust way to check this.
Description
This PR updates
ResampledWCS
to account for the fact that pixel indices represent the centres of pixels and therefore a shift must be applied when converting between pixel grids.Fixes #